
<script>
	export default {
		onLaunch: function() {
			console.log('App Launch')
		
			this.$store.dispatch('connectSocket')
			this.$store.commit('initUser')
			this.$utils.setTabbar(this)		
		
		},
		onShow: function() {
		
			if(this.$store.state.bgColor=='black')
			{
				
		      window.document.documentElement.setAttribute('data-theme', 'theme1');
				uni.setTabBarStyle({
					color:'#24b124',
					selectedColor:'#fff',
					backgroundColor:'#2F3142'
					
				})
				uni.setTabBarItem({
					index: 0,
					iconPath: '/static/hq1@3x.png',
					selectedIconPath: '/static/hq01@3x.png'
				})
				
				uni.setTabBarItem({
					index: 1,
					iconPath: '/static/dd1@3x.png',
					selectedIconPath: '/static/dd1 1@3x.png'
				})
				
				uni.setTabBarItem({
					index: 2,
					iconPath: '/static/jy1@3x.png',
					selectedIconPath: '/static/jy1 1@3x.png'
				})
				uni.setTabBarItem({
					index: 3,
					iconPath: '/static/zx1@3x.png',
					selectedIconPath: '/static/zx1 1@3x.png'
				})
				uni.setTabBarItem({
					index: 4,
					iconPath: '/static/wd1@3x.png',
					selectedIconPath: '/static/wd1 1@3x.png'
				})
			}else{
				
				window.document.documentElement.setAttribute('data-theme', 'theme2');
				uni.setTabBarStyle({
					color:'#0C0C0C',
					selectedColor:'#3F47F4',
					backgroundColor:'#FFFFFF'
					
				})
				
				uni.setTabBarItem({
					index: 0,
					"iconPath": "static/tabbar/hq1@3x.png",
					"selectedIconPath": "static/tabbar/hq2@3x.png"
				})
				
				uni.setTabBarItem({
					index: 1,
					"iconPath": "static/tabbar/dd1@3x.png",
					"selectedIconPath": "static/tabbar/dd2@3x.png"
				})
				
				uni.setTabBarItem({
					index: 2,
					"iconPath": "static/tabbar/jy1@3x.png",
					"selectedIconPath": "static/tabbar/jy2@3x.png"
				})
				uni.setTabBarItem({
					index: 3,
					"iconPath": "static/tabbar/zx1@3x.png",
					"selectedIconPath": "static/tabbar/zx2@3x.png"
				})
				uni.setTabBarItem({
					index: 4,
					"iconPath": "static/tabbar/wd1@3x.png",
					"selectedIconPath": "static/tabbar/wd2@3x.png"
				})
				
				
			}
			console.log('App Show')
		},
		watch: {
		  	'$store.state.bgColor'(val){
				 if(val=='black')
				 {
					 window.document.documentElement.setAttribute('data-theme', 'theme1');
					 				uni.setTabBarStyle({
					 					color:'#9194B1',
					 					selectedColor:'#fff',
					 					backgroundColor:'#2F3142'
					 					
					 				})
					 				uni.setTabBarItem({
					 					index: 0,
					 					iconPath: '/static/hq1@3x.png',
					 					selectedIconPath: '/static/hq01@3x.png'
					 				})
					 				
					 				uni.setTabBarItem({
					 					index: 1,
					 					iconPath: '/static/dd1@3x.png',
					 					selectedIconPath: '/static/dd1 1@3x.png'
					 				})
					 				
					 				uni.setTabBarItem({
					 					index: 2,
					 					iconPath: '/static/jy1@3x.png',
					 					selectedIconPath: '/static/jy1 1@3x.png'
					 				})
					 				uni.setTabBarItem({
					 					index: 3,
					 					iconPath: '/static/zx1@3x.png',
					 					selectedIconPath: '/static/zx1 1@3x.png'
					 				})
					 				uni.setTabBarItem({
					 					index: 4,
					 					iconPath: '/static/wd1@3x.png',
					 					selectedIconPath: '/static/wd1 1@3x.png'
					 				})
				 }else if(val=='while'){
					 window.document.documentElement.setAttribute('data-theme', 'theme2');
					 uni.setTabBarStyle({
					 	color:'#0C0C0C',
					 	selectedColor:'#3F47F4',
					 	backgroundColor:'#FFFFFF'
					 	
					 })
					 
					 uni.setTabBarItem({
					 	index: 0,
					 	"iconPath": "static/tabbar/hq1@3x.png",
					 	"selectedIconPath": "static/tabbar/hq2@3x.png"
					 })
					 
					 uni.setTabBarItem({
					 	index: 1,
					 	"iconPath": "static/tabbar/dd1@3x.png",
					 	"selectedIconPath": "static/tabbar/dd2@3x.png"
					 })
					 
					 uni.setTabBarItem({
					 	index: 2,
					 	"iconPath": "static/tabbar/jy1@3x.png",
					 	"selectedIconPath": "static/tabbar/jy2@3x.png"
					 })
					 uni.setTabBarItem({
					 	index: 3,
					 	"iconPath": "static/tabbar/zx1@3x.png",
					 	"selectedIconPath": "static/tabbar/zx2@3x.png"
					 })
					 uni.setTabBarItem({
					 	index: 4,
					 	"iconPath": "static/tabbar/wd1@3x.png",
					 	"selectedIconPath": "static/tabbar/wd2@3x.png"
					 })
					 
				 }
		
		   }
		   
		  },
		onHide: function() {
			console.log('App Hide')
		}
	}
</script>
<style>
	@import "colorui/main.css";
	@import "colorui/icon.css";
	@import "common/iconfont.css";
</style>
<style lang="scss">
	
	@import "uview-ui/index.scss";
	.cu-list.menu>.cu-item.arrow>.cu-item.isactive{
		background: #222;
	}
	/deep/.cu-list.menu>.cu-item.arrow .isactive{
		background: #222;
	}
	page[data-theme='pink']{
		 background: #1A1C24 !important;
		 position: fixed;
		    overflow: hidden;
	}
	page{
		// background: #ffff7f !important;
		
	}
	page{
		@include bg_color(theme)
	}
	
</style>

